﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SimpleTaskManager.Domain.Entities;

namespace SimpleTaskManager.Domain.Abstract
{
    /// <summary>
    /// An interface for a repository containing the tasks
    /// </summary>
    public interface ITaskRepository
    {
        /// <summary>
        /// A collection of the tasks present in the application
        /// </summary>
        IQueryable<Task> Tasks { get; }

        /// <summary>
        /// Adds a sub task to a task.
        /// </summary>
        /// <param name="id">The ID of the parent task</param>
        /// <param name="task">The new task entity, which will be added as subtask</param>
        void CreateSubTask(int id, Task task);

        /// <summary>
        /// Saves the modifications of a task.
        /// </summary>
        /// <param name="task">The task to modify</param>
        void EditTask(Task task);

        /// <summary>
        /// Deletes a task.
        /// </summary>
        /// <param name="id">The ID of the task to delete</param>
        void DeleteTask(int id);

        /// <summary>
        /// Adds a report to a task.
        /// </summary>
        /// <param name="TaskId">The ID of the task to which the report will be added</param>
        /// <param name="report">The new report entity that will be added to the task</param>
        void AddReport(int TaskId, ReportHeader report);

        /// <summary>
        /// Sets a specified report to approved.
        /// </summary>
        /// <param name="taskId">The ID of the task which contains the report</param>
        /// <param name="reportId">The ID of the report which will be approved</param>
        /// <param name="approverId">The ID of the user who approved the report</param>
        void ApproveReport(int taskId, int reportId, int approverId);

        /// <summary>
        /// Adds a user to the group associated with the a task.
        /// </summary>
        /// <param name="taskId">The ID of the task which group will be extended</param>
        /// <param name="userId">The ID of the user who will be added to the group</param>
        void AssignUserToTask(int taskId, int userId);

        /// <summary>
        /// Removes a user from the group of the task.
        /// </summary>
        /// <param name="taskId">The ID of the task which group will be changed</param>
        /// <param name="userId">The ID of the user who will be deleted from the group</param>
        void RemoveUserFromGroup(int taskId, int userId);

        /// <summary>
        /// Adds a task as required to another task.
        /// </summary>
        /// <param name="taskId">The ID of the task which will require the other task</param>
        /// <param name="reqId">The ID of the required task</param>
        void AddRequirement(int taskId, int reqId);

        /// <summary>
        /// Removes a task from the requirements of another task
        /// </summary>
        /// <param name="taskId">The ID of the task which won't require the other task any more</param>
        /// <param name="reqId">The ID of the task which will be removed from the requirements</param>
        void RemoveRequirement(int taskId, int reqId);
    }
}
